package com.pda.xinma.presenter;

import com.pda.xinma.bean.HandingInListBean;
import com.pda.xinma.contract.HandingInWaitContract;
import com.pda.xinma.net.NetUtils;
import com.wangshen.base.net.bean.BaseRowsAppEntity;
import com.wangshen.base.ui.mvp.base.presenter.BasePresenter;

import java.util.List;

import io.reactivex.functions.Consumer;

public class HandingInWaitPresenter extends BasePresenter<HandingInWaitContract.View> implements HandingInWaitContract.Presenter  {
    @Override
    public void selectEntryList(String type, String searchValue,int pager) {
        NetUtils.geApi().selectEntryList(type, searchValue,pager,10)
                .compose(this.handleEverythingResult())
                .subscribe(new Consumer<BaseRowsAppEntity<List<HandingInListBean>>>() {
                    @Override
                    public void accept(BaseRowsAppEntity<List<HandingInListBean>> listBaseRowsAppEntity) throws Exception {
                        getView().setDataList(listBaseRowsAppEntity.getRows());
                    }
                }, new Consumer<Throwable>() {
                    @Override
                    public void accept(Throwable throwable) throws Exception {
                        getView().showMessage(throwable.getMessage());
                    }
                });
    }
}
